package com.bawei.yangzongcai___chenmei.SlindingMenu;



import androidx.recyclerview.widget.RecyclerView;
import androidx.recyclerview.widget.StaggeredGridLayoutManager;

import com.bawei.yangzongcai___chenmei.Adpter.WQWadpterActivity1;
import com.bawei.yangzongcai___chenmei.JavaClass.JavaYaZhou;
import com.bawei.yangzongcai___chenmei.MVC.BsaeActivity;
import com.bawei.yangzongcai___chenmei.R;
import com.google.gson.Gson;
import com.lzy.okgo.OkGo;
import com.lzy.okgo.callback.StringCallback;
import com.lzy.okgo.model.Response;

import java.util.ArrayList;
import java.util.List;

public class SlingMenuActivity3 extends BsaeActivity {

    List<JavaYaZhou.ResBean.AvatarBean> list;
    private RecyclerView sling;
    WQWadpterActivity1  qqaq;
    @Override
    public int bandLayout() {
        return R.layout.activity_sling_menu3;
    }

    @Override
    public void initView() {
        sling = findViewById(R.id.slingmenuActivity3_RV);
        sling.setLayoutManager(new StaggeredGridLayoutManager(1,StaggeredGridLayoutManager.VERTICAL));
    }

    @Override
    public void initDate() {

        OkGo.<String>get("http://service.picasso.adesk.com/v1/avatar/avatar?cid=55f7e7f369401b22dc65fe11&limit=30&adult=false&first=1&order=hot").execute(new StringCallback() {
            @Override
            public void onSuccess(Response<String> response) {
                Gson gson = new Gson();
                JavaYaZhou yaZhou = gson.fromJson(response.body().toString(),JavaYaZhou.class);
                list = new ArrayList<>();
                list=yaZhou.getRes().getAvatar();
                qqaq = new WQWadpterActivity1(list);
                sling.setAdapter(qqaq);

            }
        });
    }




}
